VPATH	= .

# target might be WINDOWS, OS_X or LINUX

TARGET = OS_X
# Home directory of the acw program
HOME=.

# point to the inclue directory
SOURCEDIR = source
FITSDIR = cfitsio
LIBDIR = libs
INCLUDES =  -I$(SOURCEDIR)  -I$(FITSDIR) -I/sw/include
# library dir


# compiler specific flags
CFLAGS =  -O3 -D$(TARGET) 
#CFLAGS = -g -D$(TARGET)
# -heap-arrays -vec-report0
FFLAGS =  -Llibs -lcfitsio -lfftw3 -lm


PROJECT = gamer


_obj 	=  CParticle.o C2DImage.o perlin.o CGalaxy.o CVector.o  C3DField.o C2DField.o CBitMap.o CUtil.o CMath.o  CMPI.o CGalaxyComponent.o CGalaxyComponentStars.o CGalaxyComponentDisk.o CGalaxyComponentDust.o CGraph.o CRasterizer.o CGamer.o CInterface.o

obj = $(patsubst %,$(SOURCEDIR)/%,$(_obj))

_objGamer 	=  gamermain.o
objGamer = $(patsubst %,$(SOURCEDIR)/%,$(_objGamer))

_objGutil 	=  gutil.o
objGutil = $(patsubst %,$(SOURCEDIR)/%,$(_objGutil))


CC 	= mpic++ 

default: $(PROJECT)

$(PROJECT):  $(obj) $(objGamer)
	$(CC)  -L$(LIBDIR)  $(INCLUDES) -o bin/$(PROJECT) $(obj) $(objGamer) $(FFLAGS)  

%.o: %.cpp
	$(CC) -c -o $@ $^ $(INCLUDES) $(CFLAGS)   

%.o: %.cu
	$(CC) -c -o $@ $^ $(INCLUDES) $(CFLAGS)   


clean:	
	rm *.o source/*.o bin/*

gutil:	$(obj) $(objGutil)
	$(CC)  -L$(LIBDIR)  $(INCLUDES) -o bin/gutil $(obj) $(objGutil) $(FFLAGS)  

lib:	$(obj) 
	ar cr lib$(PROJECT).a $(obj)


all: default gutil lib